<script setup>
import {ref,computed} from 'vue'
import {ElMessage} from "element-plus";
import {PostFile} from "@/axios/api.js";
import {Upload} from "@element-plus/icons-vue";

// const proFileData = defineProps(['proFileData'])
// const myVariable = ref(proFileData.proFileData);
// console.log(myVariable.value)
// const allRiverNames = computed(() => {
//   return myVariable.value.map(riverObj => riverObj.river.name);
// });
// const rivers =

// 使用计算属性缓存河流名称
// const allRiverNames = computed(() => {
//   return myVariable.value.map(riverObj => riverObj.river.name);
// });
const proFileData = ref()

function importSubmitXLSX(e,filerow,fileList) {

  const file=filerow.raw;
  uploadXLSX(file);

}

function uploadXLSX(xlsxFile){
  console.log("xlsxFile dbffile:"+xlsxFile)
  const formData=new FormData()
  formData.append("file",xlsxFile)

  PostFile('/River/upload',formData).then((response) => {
    console.log("xlsxFile response.data:"+response.data);
    const { code, msg,data: res } = response.data;
    if (code === 200) {
      console.log("success:"+msg+"xlsxFile 结束:"+res);
      proFileData.value = response.data
    } else {
      console.log("fail:"+msg);
      ElMessage.error("xlsxFile 失败");
    }
  });
}
import popup from "./RiverEnv/Popup.vue"
</script>

<template>
<!--  <popup></popup>-->
<!--  <el-upload-->
<!--      :auto-upload="true"-->
<!--      :on-change="importSubmitXLSX"-->
<!--      accept=".xlsx,.zip"-->
<!--  >-->
<!--    <div>-->
<!--      <el-button-->
<!--          type="primary" text='primary'>-->
<!--        <el-icon><Upload /></el-icon>-->
<!--        上传河道地勘测量EXCEL-->
<!--      </el-button>-->
<!--    </div>-->
<!--  </el-upload>-->
<!--  <p>123</p>-->
<!--<p>{{myVariable}}</p>-->
<!--  <p>{{allRiverNames}}</p>-->
</template>

<style scoped>

</style>